import User from "@/api/user";
import {
  ref,
  onMounted,
  defineComponent,
  reactive,
  Ref,
  toRefs,
  isReactive,
} from "vue";
import { ElButton } from "element-plus";

export default defineComponent({
  setup() {
    let hh = ref("我是 HelloWorld 组件");
    let state1 = reactive<any>({
      data: [],
    });
    onMounted(async () => {
      // await User.login("/api/query", { username: "llll" });
      // const res = await User.req11("/api/data", { username: "llll" });
      // state1.data.push(...res.data);
    });
    const change = () => {
      state1.data.push({ name: "7777" });
    };
    return {
      hh,
      change,
      state1,
    };
  },
  render() {
    return (
      <div>
        <div>{this.hh}</div>
        <ElButton onClick={this.change} type="primary">
          1231
        </ElButton>
        {this.state1.data.map((item: { name: string }) => {
          return <div>{item.name}</div>;
        })}
      </div>
    );
  },
});
